package com.bootdo.finance.controller;

import com.bootdo.client.domain.ClientDO;
import com.bootdo.client.service.ClientService;
import com.bootdo.common.utils.PageUtils;
import com.bootdo.common.utils.Query;
import com.bootdo.supplier.domain.SupplierDO;
import com.bootdo.supplier.service.SupplierService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;
import java.util.Map;

@Controller
@RequestMapping("/fin/ct")
public class FclientControllre {
    @Autowired
    private ClientService clientService;
    @Autowired
    private SupplierService supplierService;


    @ResponseBody
    @GetMapping("/list")
    public PageUtils list(@RequestParam Map<String, Object> params){
        //查询列表数据
        Query query = new Query(params);
        List<ClientDO> clientList = clientService.list(query);
        int total = clientService.count(query);
        PageUtils pageUtils = new PageUtils(clientList, total);
        return pageUtils;

    }

    @GetMapping("/table")
    public String table(){return "finance/collectionfrom/fclient";}


    @ResponseBody
    @GetMapping("/list1")
    public PageUtils list1(@RequestParam Map<String, Object> params){
        //查询列表数据
        Query query = new Query(params);
        List<SupplierDO> clientList = supplierService.list(query);
        int total = supplierService.count(query);
        PageUtils pageUtils = new PageUtils(clientList, total);
        return pageUtils;

    }
    @GetMapping("/table1")
    public String table1(){return "finance/collectionfrom/fclient";}
}
